<template>
	<u-cell-group>
		<u-cell title="实名认证状态" arrow-direction @click="authenticationHandler">
			<span slot="value" :style="[computedStyle]">{{isCertification?"认证完成":"未认证"}}</span>
		</u-cell>
		<u-cell title="身份证照片">
			<span slot="value" :style="[computedStyle]">{{isCertification?"已上传":"未上传"}}</span>
		</u-cell>
	</u-cell-group>
</template>

<script>
	import {
		isFarmerAuthentication
	} from "apis/farmer/user.js"
	export default {
		data() {
			return {
				isCertification: false, //认证状态
			}
		},
		computed: {
			computedStyle() {
				return this.isCertification ? {
					color: 'rgba(255, 87, 51, 1)'
				} : {
					color: 'rgba(166, 166, 166, 1)'
				}
			}
		},
		methods: {
			authenticationHandler() {
				if(this.isCertification) return null
				console.log(this.isCertification)
				this.pushNewPage("idPhoto")
				// const userstatus = getApp().globalData.userinfo.userStatus;
				// this.isCertification = userstatus >= 0 ? true : false;
			}
		},
		async onShow() {
			const {
				data
			} = await isFarmerAuthentication()
			this.isCertification = data
		}
	}
</script>

<style>

</style>
